﻿<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <!--_meta 作为公共模版分离出去-->
    <% layout("/common/_meta.html",{title:"添加权限"}){} %>
    <!--_meta 作为公共模版分离出去-->
</head>
<body style="background-color:#fff">
<div class="wap-container">
    <div class="panel">
        <div class="panel-body">
            <form action="${ctxPath}/permission/add" method="post" class="form form-horizontal" id="form-permission-add">
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>上级权限：</label>
                    <div class="form-controls col-xs-8 col-sm-8">
                        <span class="select-box">
                            <select class="select" name="parentId" size="1">
                                <option value="0">--顶级权限--</option>
                                <%for(top in tops){%>
                                    <option value="${top.id}">${top.name}</option>
                                    <%for(sec in top.children){%>
                                        <option value="${sec.id}">&nbsp;&nbsp;&nbsp;${sec.name}</option>
                                    <%}%>
                                <%}%>
                            </select>
                        </span>
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>权限名称：</label>
                    <div class="form-controls col-xs-8 col-sm-8">
                        <input type="text" class="input-text" value="${permission.name!}" placeholder="权限名称" id="name" name="name">
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>权限编码：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        <input type="text" class="input-text" value="${permission.code!}" placeholder="权限编码" id="code" name="code">
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3">图标(<a href="${ctxPath}/permission/icon" target="_blank">查看</a>)：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        <input type="text" class="input-text" value="${permission.icon!}" placeholder="图标" id="icon" name="icon">
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3">链接：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        <input type="text" class="input-text" value="${permission.url!}" placeholder="链接" id="url" name="url">
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>菜单显示：</label>
                    <div class="form-controls col-xs-8 col-sm-8 skin-minimal">
                        <div class="radio-box">
                            <input name="isLink" type="radio" id="isLink-1" value="true" checked>
                            <label for="isLink-1">是</label>
                        </div>
                        <div class="radio-box">
                            <input name="isLink" type="radio" id="isLink-0" value="false">
                            <label for="isLink-0">否</label>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>排序：</label>
                    <div class="form-controls col-xs-8 col-sm-8">
                        <input type="text" class="input-text" value="${permission.sort!}" placeholder="排序[1-99]" id="sort" name="sort">
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-xs-8 col-sm-8 col-xs-offset-3 col-sm-offset-3">
                        <button type="submit" class="btn btn-success btn-block radius">添加权限</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<% layout("/common/_footer.html"){} %>
<% layout("/common/_validate.html"){} %>
<!--/_footer 作为公共模版分离出去-->
<script type="text/javascript">
    $(function(){
        $("#form-permission-add").validate({
            rules:{
                parentId:{
                    required:true
                },
                name:{
                    required:true,
                    maxlength:50
                },
                code:{
                    required:true,
                    maxlength:100
                },
                url:{
                    maxlength:255
                },
                icon:{
                    maxlength:50
                },
                isLink:{
                    required:true
                },
                sort:{
                    required:true,
                    digits:true,
                    range:[1,99]
                }
            },
            submitHandler:function(form){
                loading();
                form.submit();
            }
        });
    });
</script>
</body>
</html>
